<%@page import="java.sql.Statement"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.Connection"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>更新处理中</title>
<% 
	String user=null;
	Cookie[] cookie=request.getCookies();
	if(cookie!=null){
		for(int i=0;i<cookie.length;i++){
			if(cookie[i].getName().equals("SilverCouldUserName")==true){
				user=cookie[i].getValue();
			}
		}
	}
	if((user=="")||(user==null)){
		out.println("您还没有登陆，请进入登陆页面登陆：<br/>");
		out.println("<a href=\"index.jsp\">重新登陆</a>");
		return ;
	}
	request.setCharacterEncoding("UTF-8"); 
	String name=request.getParameter("caption");
	String detail=request.getParameter("detail");
	String hidden=request.getParameter("hidden");
	
	//更新数据库
	Class.forName("com.mysql.jdbc.Driver");
	Connection con=DriverManager.getConnection(application.getAttribute("dburl")+"?useUnicode=true&characterEncoding=utf8",(String) application.getAttribute("username"),(String) application.getAttribute("password"));
	Statement sm=con.createStatement();
	String sqls1="UPDATE data SET name='"+name+"',detail='"+detail+"',hidden="+hidden+" WHERE id="+session.getAttribute("id");
	int UpdateCount=sm.executeUpdate(sqls1);
	String info="";
	if(UpdateCount!=0){
		info="更新成功，更新的id是："+session.getAttribute("id");
	}else{
		info="更新失败，请重试！";
	}
	session.removeAttribute("id");
%>
</head>
<body>
<center>
<h1><font color="red">银光字幕组专属云服务后台管理系统-更新资源中</font></h1>
当前账户：<%=session.getAttribute("username") %>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="logout.jsp">安全注销</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="main.jsp">返回主页</a><br/>
<%=info %>
</center>
</body>
</html>